package io.xccit.race.service.impl;

import java.util.List;
import io.xccit.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import io.xccit.race.mapper.RaceCompetitionDetailMapper;
import io.xccit.race.domain.RaceCompetitionDetail;
import io.xccit.race.service.IRaceCompetitionDetailService;

/**
 * 竞赛详情Service业务层处理
 * 
 * @author ywx
 * @date 2025-10-9
 */
@Service
public class RaceCompetitionDetailServiceImpl implements IRaceCompetitionDetailService 
{
    @Autowired
    private RaceCompetitionDetailMapper raceCompetitionDetailMapper;

    /**
     * 查询竞赛详情
     * 
     * @param id 竞赛详情主键
     * @return 竞赛详情
     */
    @Override
    public RaceCompetitionDetail selectRaceCompetitionDetailById(Long id)
    {
        return raceCompetitionDetailMapper.selectRaceCompetitionDetailById(id);
    }

    /**
     * 根据竞赛ID查询竞赛详情
     * 
     * @param competitionId 竞赛ID
     * @return 竞赛详情
     */
    @Override
    public RaceCompetitionDetail selectRaceCompetitionDetailByCompetitionId(Long competitionId)
    {
        return raceCompetitionDetailMapper.selectRaceCompetitionDetailByCompetitionId(competitionId);
    }

    /**
     * 查询竞赛详情列表
     * 
     * @param raceCompetitionDetail 竞赛详情
     * @return 竞赛详情
     */
    @Override
    public List<RaceCompetitionDetail> selectRaceCompetitionDetailList(RaceCompetitionDetail raceCompetitionDetail)
    {
        return raceCompetitionDetailMapper.selectRaceCompetitionDetailList(raceCompetitionDetail);
    }

    /**
     * 新增竞赛详情
     * 
     * @param raceCompetitionDetail 竞赛详情
     * @return 结果
     */
    @Override
    public int insertRaceCompetitionDetail(RaceCompetitionDetail raceCompetitionDetail)
    {
        raceCompetitionDetail.setDelFlag("0");
        raceCompetitionDetail.setCreateTime(DateUtils.getNowDate());
        return raceCompetitionDetailMapper.insertRaceCompetitionDetail(raceCompetitionDetail);
    }

    /**
     * 修改竞赛详情
     * 
     * @param raceCompetitionDetail 竞赛详情
     * @return 结果
     */
    @Override
    public int updateRaceCompetitionDetail(RaceCompetitionDetail raceCompetitionDetail)
    {
        raceCompetitionDetail.setUpdateTime(DateUtils.getNowDate());
        return raceCompetitionDetailMapper.updateRaceCompetitionDetail(raceCompetitionDetail);
    }

    /**
     * 批量删除竞赛详情
     * 
     * @param ids 需要删除的竞赛详情主键
     * @return 结果
     */
    @Override
    public int deleteRaceCompetitionDetailByIds(Long[] ids)
    {
        return raceCompetitionDetailMapper.deleteRaceCompetitionDetailByIds(ids);
    }

    /**
     * 删除竞赛详情信息
     * 
     * @param id 竞赛详情主键
     * @return 结果
     */
    @Override
    public int deleteRaceCompetitionDetailById(Long id)
    {
        return raceCompetitionDetailMapper.deleteRaceCompetitionDetailById(id);
    }

    /**
     * 根据竞赛ID删除竞赛详情
     * 
     * @param competitionId 竞赛ID
     * @return 结果
     */
    @Override
    public int deleteRaceCompetitionDetailByCompetitionId(Long competitionId)
    {
        return raceCompetitionDetailMapper.deleteRaceCompetitionDetailByCompetitionId(competitionId);
    }
}
